#include <stdio.h>
#define N 30
int fun(int a[], int n) 
{
    int i, j;
    for (i = 1, j = 0; i < n; i++) {
        if (a[i] != a[j]) { 
            a[++j] = a[i];  
        }
    }
    return j + 1;
}
int main() 
{
    int a[N] = {2,2,2,3,4,4,5,6,6,6,6,7,7,8,9,9,10,10,10,10};
    int i, n = 20;
    printf("The original data :\n");
    for (i = 0; i < n; i++) {
        printf("%3d", a[i]);
    }
    n = fun(a, n);
    printf("\n\nThe data after deleted :\n");
    for (i = 0; i < n; i++) {
        printf("%3d", a[i]);
    }
    printf("\n");
    return 0;
}
